home *** CD-ROM | disk | FTP | other *** search
/ BBS Toolkit / BBS Toolkit.iso / windows / qkdial.zip / QKDIAL.WAS < prev   
Text File  |  1992-12-17  |  9KB  |  154 lines

  1. ;QUIKDIAL v. 1.1  Allows a first quick pass through the dialing queue
  2. ;****************************************************************************
  3. ;*                                                                          *
  4. ;* QUIKDIAL.WAS                                                             *
  5. ;* Copyright (C) 1992 Datastorm Technologies, Inc.                          *
  6. ;* All rights reserved.                                                     *
  7. ;*                                                                          *
  8. ;* Purpose:  Dials a queue of numbers from the Dialing Directory once       *
  9. ;*           without pausing between attempts, then falls back to the       *
  10. ;*           default pause.  This offers essentially the same functionality *
  11. ;*           as pressing the Space Bar between calls in PROCOMM PLUS for    *
  12. ;*           DOS.  You can quickly sample a queue of busy numbers, then     *
  13. ;*           revert back a long pause so your own phone line isn't          *
  14. ;*           tied up constantly.                                            *
  15. ;*                                                                          *
  16. ;* This ASPECT SCRIPT is intended only as a sample of ASPECT programming.   *
  17. ;* DATASTORM makes no warranty of any kind, express or implied, including   *
  18. ;* without limitation, any warranties of merchantability and/or fitness     *
  19. ;* for a particular purpose.  Use of this program is at your own risk.      *
  20. ;*                                                                          *
  21. ;* Author:  Chuck Spohr                                                     *
  22. ;*                                                                          *
  23. ;****************************************************************************
  24.  
  25. ;****************************************************************************
  26. ;*   GLOBAL VARIABLES                                                       *
  27. ;****************************************************************************
  28.  
  29. integer Max, CPause
  30.  
  31. ;****************************************************************************
  32. ;*                                                                          *
  33. ;* MAIN                                                                     *
  34. ;* The Main Procedure simply calls its supporting routines to initialize,   *
  35. ;* dial and finally, clean up.                                              *
  36. ;*                                                                          *
  37. ;* Calls:  Initialize, DialQ, Cleanup                                       *
  38. ;* Modifies globals:  Max, CPause                                           *
  39. ;*                                                                          *
  40. ;****************************************************************************
  41.  
  42. proc Main
  43.    Initialize()
  44.    DialQ()
  45.    Cleanup()
  46. endproc
  47.  
  48. ;****************************************************************************
  49. ;*                                                                          *
  50. ;* INITIALIZE                                                               *      *
  51. ;* The Initialize procedure first checks to see if the script has been      *
  52. ;* chained from a previous script, and exits if it has.  This is necessary  *
  53. ;* for the Cleanup procdure to work correctly.  Initialize then sets        *
  54. ;* records the existing Call Pause and Dial Attemps settings, and sets      *
  55. ;* them to 0 and 1, respectively.                                            *
  56. ;*                                                                          *
  57. ;* Calls:  Cleanup                                                          *
  58. ;* Called by: Main                                                          *
  59. ;* Modifies globals:  Max, CPause                                           *
  60. ;*                                                                          *
  61. ;****************************************************************************
  62.  
  63. proc Initialize
  64.    if $CHAINED                       
  65.       exit                         ; Quit if a script is already running
  66.    endif                           ; (Necessary for Cleanup procedure)
  67.  
  68.    when userexit call Cleanup      ; Intercept exit attempt by user
  69.    set aspect spawn ON             ; Allow other scripts to run
  70.    
  71.    fetch dialdir callpause CPause  ; Obtain Pause Between Calls setting
  72.    fetch dialdir maxdial Max       ; Obtain current Max Dial Attempts setting
  73.    if Max > 99                     ; Can't set it over 99
  74.       Max = 99
  75.    endif
  76.  
  77.    set dialdir maxdial 1           ; Set these values temporarily
  78.    set dialdir callpause 0
  79. endproc
  80.  
  81. ;****************************************************************************
  82. ;*                                                                          *
  83. ;* DIALQ                                                                    *
  84. ;* The DialQ procedure opens the Dialing Directory and waits for the user   *
  85. ;* to begin Dialing.  If the user closes the directory before dialing,      *
  86. ;* we'll sense it and shut down the script.  When the user clicks Dial,     *
  87. ;* DialQ dials the Queue of entries, checks see if we have carrier,         *
  88. ;* restores the original Dial Dir settings, and tries again if necessary.   *
  89. ;*                                                                          *
  90. ;* Calls:  Cleanup                                                          *
  91. ;* Called by: Main                                                          *
  92. ;* Modifies globals:  Max, CPause                                           *
  93. ;*                                                                          *
  94. ;****************************************************************************
  95.    
  96. proc DialQ   
  97.    if not $DIALDIR                 ; If Dialing Directory is not already open,
  98.       dialdir ON                   ; open it
  99.       while 1                               ; Wait until user Dials
  100.          if $DIALING
  101.             exitwhile
  102.          elseif not ($DIALDIR || $DIALING)  ; If user closes Dial Dir before
  103.             Cleanup()                       ; dialing, clean up and exit 
  104.          endif                              ; script
  105.       endwhile
  106.    else
  107.       dialqueue                    ; Dial the currently queued numbers
  108.    endif
  109.  
  110.    while $DIALING                  ; Wait until dialing stops
  111.    endwhile
  112.    
  113.    set dialdir maxdial Max         ; Restore Pause and Max Dial Attempts
  114.    set dialdir callpause CPause
  115.    
  116.    pause 2                         ; Pause to let carrier go high
  117.  
  118.    if not $CARRIER                 ; If we didn't make a connection,
  119.       dialqueue                    ; try again with original settings
  120.       while $DIALING               ; Wait until dialing stops
  121.       endwhile
  122.    endif
  123.    Cleanup()                       ; Exit!
  124. endproc
  125.  
  126. ;****************************************************************************
  127. ;*                                                                          *
  128. ;* CLEANUP                                                                  *
  129. ;* The Cleanup procedure is called whenever a user attempts to exit, or     *
  130. ;* when the MAIN has finished.  It first sets the Max Dial Attempts and     *
  131. ;* Pause Between Attempts setting back to their default values, then if the *
  132. ;* Action Bar is active, it runs this script again to make it the current   *
  133. ;* script rather than the one in the last Dialing Directory entry dialed.   *
  134. ;*                                                                          *
  135. ;* Calls:  none                                                             *
  136. ;* Called by: Main, WHEN USEREXIT                                           *
  137. ;* Modifies globals:  none                                                  *
  138. ;*                                                                          *
  139. ;****************************************************************************
  140.  
  141. proc Cleanup
  142.    set dialdir maxdial Max         ; Restore Pause and Max Dial Attemps
  143.    set dialdir callpause CPause
  144.    
  145.    dialcancel                      ; Cancel any dialing that might be occuring
  146.    dialdir OFF                     ; Close Dialing Directory
  147.    
  148.    if $ACTIONBAR                   ; This will restore "QUIKDIAL" as the
  149.       chain $SCRIPT                ;    current script on the Action Bar
  150.    endif
  151.    
  152.    exit                            ; Quit the script
  153. endproc
  154.